package com.ruoyi.client.controller;


import com.ruoyi.client.service.IUserTService;
import com.ruoyi.client.util.ResponseResult;
import com.ruoyi.common.core.controller.BaseController;
import com.taobao.api.ApiException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户管理Controller
 * 
 * @author ruoyi
 * @date 2024-10-17
 */
@RestController
@RequestMapping("/client/user")
public class ClientUserTController extends BaseController
{
    @Autowired
    private IUserTService userTService;

    /**
     * 根据钉钉的access_token初始化用户信息
     * */
    @GetMapping("/init/{authCode}")
    public ResponseResult initUser(@PathVariable("authCode" ) String authCode) throws ApiException {
        return ResponseResult.success(userTService.initUser(authCode));
    }

    @GetMapping("/{userId}")
    public ResponseResult getUserById(@PathVariable("userId")String userId){
        return ResponseResult.success(userTService.getUserById(userId));
    }
}
